//
//  PigBasicInformationView.m
//  PigMarket
//
//  Created by mac on 2019/4/9.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "PigBasicInformationView.h"

@implementation PigBasicInformationView
#pragma mark - init method
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initLayout];
    }
    return self;
}

- (void)initView {
    [self addSubview:self.pigInfoTitle];
    [self addSubview:self.pigInfoLine];
    [self addSubview:self.weightLab];
    [self addSubview:self.priceLab];
    [self addSubview:self.birthdayLab];
    [self addSubview:self.currentDaysLab];
    [self addSubview:self.dateLab];
    [self addSubview:self.breedGroundLab];
    [self addSubview:self.weightDetailLab];
    [self addSubview:self.priceDetailLab];
    [self addSubview:self.birthdayDetailLab];
    [self addSubview:self.currentDaysDetailLab];
    [self addSubview:self.dateDetailLab];
    [self addSubview:self.breedGroundDetailLab];
}
- (void)initLayout {
    
    [self.pigInfoTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
    }];
    [self.pigInfoLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.pigInfoTitle.mas_bottom).offset(10);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.height.mas_equalTo(1);
    }];
    [self.weightLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.pigInfoLine.mas_bottom).offset(15);
    }];
    [self.priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.weightLab.mas_bottom).offset(10);
    }];
    [self.birthdayLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.priceLab.mas_bottom).offset(10);
    }];
    [self.currentDaysLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.birthdayLab.mas_bottom).offset(10);
    }];
    [self.dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.currentDaysLab.mas_bottom).offset(10);
    }];
    [self.breedGroundLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.dateLab.mas_bottom).offset(10);
        make.bottom.mas_equalTo(-22);
    }];
    [self.weightDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(100);
        make.centerY.mas_equalTo(self.weightLab.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
    [self.priceDetailLab  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(100);
        make.centerY.mas_equalTo(self.priceLab.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
    [self.birthdayDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(100);
        make.centerY.mas_equalTo(self.birthdayLab.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
    [self.currentDaysDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(100);
        make.centerY.mas_equalTo(self.currentDaysLab.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
    [self.dateDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(100);
        make.centerY.mas_equalTo(self.dateLab.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
    [self.breedGroundDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(100);
        make.centerY.mas_equalTo(self.breedGroundLab.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
}
+ (UILabel *)initTitleLabWithText:(NSString *)text {
    UILabel *lab = [[UILabel alloc] init];
    lab = [[UILabel alloc] init];
    lab.textColor = [UIColor colorWithHexString:@"#999999"];
    lab.font = [UIFont systemFontOfSize:13];
    lab.text = text;
    return lab;
}
+ (UILabel *)initDetailTitleLabWithText:(NSString *)text {
    UILabel *lab = [[UILabel alloc] init];
    lab = [[UILabel alloc] init];
    lab.textColor = [UIColor textBlackColor];
    lab.font = [UIFont systemFontOfSize:13];
    lab.text = text;
    return lab;
}

- (UILabel *)pigInfoTitle {
    if (!_pigInfoTitle) {
        _pigInfoTitle = [[UILabel alloc] init];
        _pigInfoTitle.textColor = [UIColor textBlackColor];
        _pigInfoTitle.font = [UIFont largerFont];
        _pigInfoTitle.text = @"仔猪信息";
    }
    return _pigInfoTitle;
}
- (UIView *)pigInfoLine {
    if (!_pigInfoLine) {
        _pigInfoLine = [[UIView alloc] init];
        _pigInfoLine.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
    }
    return _pigInfoLine;
}
- (UILabel *)weightLab {
    if (!_weightLab) {
        _weightLab = [PigBasicInformationView initTitleLabWithText:@"仔猪体重"];
    }
    return _weightLab;
}
- (UILabel *)priceLab {
    if (!_priceLab) {
        _priceLab = [PigBasicInformationView initTitleLabWithText:@"仔猪单价"];
        
    }
    return _priceLab;
}
- (UILabel *)birthdayLab {
    if (!_birthdayLab) {
        _birthdayLab = [PigBasicInformationView initTitleLabWithText:@"出生日期"];
        
    }
    return _birthdayLab;
}
- (UILabel *)currentDaysLab {
    if (!_currentDaysLab) {
        _currentDaysLab = [PigBasicInformationView initTitleLabWithText:@"当前日龄"];
        
    }
    return _currentDaysLab;
}
- (UILabel *)dateLab {
    if (!_dateLab) {
        _dateLab = [PigBasicInformationView initTitleLabWithText:@"预出栏日"];
    }
    return _dateLab;
}
- (UILabel *)breedGroundLab {
    if (!_breedGroundLab) {
        _breedGroundLab = [PigBasicInformationView initTitleLabWithText:@"养殖地"];
    }
    return _breedGroundLab;
}
- (UILabel *)weightDetailLab {
    if (!_weightDetailLab) {
        _weightDetailLab = [PigBasicInformationView initDetailTitleLabWithText:@""];
    }
    return _weightDetailLab;
}
- (UILabel *)priceDetailLab {
    if (!_priceDetailLab) {
        _priceDetailLab = [PigBasicInformationView initDetailTitleLabWithText:@""];
        
    }
    return _priceDetailLab;
}
- (UILabel *)birthdayDetailLab {
    if (!_birthdayDetailLab) {
        _birthdayDetailLab = [PigBasicInformationView initDetailTitleLabWithText:@""];
        
    }
    return _birthdayDetailLab;
}
- (UILabel *)currentDaysDetailLab {
    if (!_currentDaysDetailLab) {
        _currentDaysDetailLab = [PigBasicInformationView initDetailTitleLabWithText:@""];
        
    }
    return _currentDaysDetailLab;
}
- (UILabel *)dateDetailLab {
    if (!_dateDetailLab) {
        _dateDetailLab = [PigBasicInformationView initDetailTitleLabWithText:@""];
    }
    return _dateDetailLab;
}
- (UILabel *)breedGroundDetailLab {
    if (!_breedGroundDetailLab) {
        _breedGroundDetailLab = [PigBasicInformationView initDetailTitleLabWithText:@""];
    }
    return _breedGroundDetailLab;
}

@end
